#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, m, l, d[100001], v[100001], cnt = 1, f[100001], c[100001];
bool b[200002];
struct Node {
	ll y, idx;
	Node (ll _y, ll _idx) {
		y = _y, idx = _idx;	
	};
	bool operator < (const Node &A) {
		return y < A.y;
	}
};
vector<Node> edge[100001];

inline void dfs(ll x) {
	while (f[x] < v[x]) {
		ll y = edge[x][f[x]].y, idx = edge[x][f[x]].idx;
		if (!b[idx]) {
			++f[x];
			b[idx] = b[idx ^ 1] = true;
 			dfs(y);
 			c[++l] = y;
		}
		else	
			++f[x];
	}
}

inline void Euler() {
	ll x = 0;
	if (!x)
		for (ll i = 1; i <= n; ++i)
			if (d[i]) {
				x = i;
				break;
			}
				
	memset(b, false, sizeof(b));
	memset(f, 0, sizeof(f));
	l = 0;
	dfs(x);
	c[++l] = x;
	for (ll i = l; i; --i)
		printf("%lld ", c[i]);
}
int main() {
	scanf("%lld%lld", &n, &m);
	for (ll i = 1; i <= m; ++i) {
		ll x, y;
		scanf("%lld%lld", &x, &y);
		edge[x].push_back(Node(y, ++cnt));
		edge[y].push_back(Node(x, ++cnt));
		++d[x]; ++d[y];
	}
	for (ll i = 1; i <= n; ++i) {
		v[i] = edge[i].size();
		sort(edge[i].begin(), edge[i].end());
	}
	Euler(); 
	return 0;
}
